var guanpai = require('guanpai');

cc.Class({
    extends: cc.Component,

    properties: {
        
    },

    // use this for initialization
    onLoad: function () {
        // debug
        if (guanpai.userData == null) {
            guanpai.userData = {id: "player007", name: "player007"};
        }

        cc.loader.loadRes("prefabs/Loading", (err, prefab)=>{
            var node = cc.instantiate(prefab);
            this.node.addChild(node);
            node.setPosition(cc.p(0, 0));
            this.scheduleOnce(()=>{
                node.destroy();
                this.lateOnLoad();
            }, 1);
        });
        
    },

    lateOnLoad: function () {
        guanpai.ui.createScreenMsg("欢迎" + guanpai.userData.id + "登陆");
    },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
